<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="<%=basePath%>statics/css/bootstrap-2.3.css">
    <title>山西旅游网站</title>
</head>
<body onLoad="checksession();" style="background-image:url('<%=basePath%>statics/images/main.png');background-size:100% 100%;">
<div class="container-fluid" >
    <div class="row-fluid">
        <div class="span12">
            <div class="row-fluid">
                <div class="span12">
                    <div class="span4"></div>
                    <div class="span4">
                        <h3>华夏古文明-山西好风光</h3>
                    </div>
                    <div class="span4"></div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span2">
                </div>
                <div class="span8">
                    <div class="navbar">
                        <div class="navbar-inner">
                            <div class="container-fluid">
                                <a data-target=".navbar-responsive-collapse" data-toggle="collapse" class="btn btn-navbar"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a> <a href="<%=basePath%>front/index.jsp" class="brand">山西旅游网</a>
                                <div class="nav-collapse collapse navbar-responsive-collapse">
                                    <ul class="nav">
                                        <li class="active">
                                            <a href="<%=basePath%>front/index.jsp">主页</a>
                                        </li>
                                        <li class="dropdown">
                                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">大好山西<strong class="caret"></strong></a>
                                            <ul class="dropdown-menu" id="citylistid">

                                            </ul>
                                        </li>
                                        <li class="dropdown">
                                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">主要景点<strong class="caret"></strong></a>
                                            <ul class="dropdown-menu" id="infolistid">

                                            </ul>
                                        </li>
                                        <li class="dropdown">
                                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">山水旅游<strong class="caret"></strong></a>
                                            <ul class="dropdown-menu" id="categorylistid">
                                            </ul>
                                        </li>
                                        <li>
                                        </li>
                                        <li>
                                            <a href="picture.jsp">读图之美</a>
                                        </li>
                                        <li>
                                            <a href="twork.jsp">意见与建议</a>
                                        </li>
                                    </ul>
                                    <ul class="nav pull-right">
                                        <li><a href="user_login.jsp" id="login">游客登录</a></li>
                                        <li><a href="user_regedit.jsp" id="regedit">游客注册</a></li>
                                        <li><a href="<%=basePath%>api/user/logout" id="logout"></a></li>
                                    </ul>
                                </div>

                            </div>

                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span9">
                            <img src="<%=basePath%>statics/images/ccdt.jpg" alt="">
                        </div>
                        <div class="span3">

                            <form action="/api/tuser/regedit" method="post">
                                <div class="mycenter">
                                    <div class="mysign">
                                        <div class="col-lg-10 text-center text-info">
                                            <h3 style="text-align:center;">游客注册</h3>
                                        </div>

                                        <div class="col-lg-10">
                                            <input type="text" id="username" class="form-control" name="userName" placeholder="请输入账户名" required autofocus/>
                                        </div>
                                        <div class="col-lg-10"></div>
                                        <div class="col-lg-10">
                                            <input type="password" class="form-control" name="userPass" placeholder="请输入密码" required autofocus/>
                                        </div>
                                        <div class="col-lg-10">
                                            <input type="email" class="form-control" name="email" placeholder="请输入邮箱" required autofocus/>
                                        </div>
                                        <div class="col-lg-10">
                                            <input type="text" class="form-control" name="mobile" placeholder="请输入手机号" required autofocus/>
                                        </div>
                                        <div class="col-lg-10"></div>
                                        <div class="col-lg-10"></div>
                                        <div class="col-lg-10 text-center">
                                            <button type="submit" class="btn btn-success col-lg-10">注册</button>
                                        </div>
                                    </div>
                                </div>
                            </form>

                        </div>
                    </div>
                </div>
                <div class="span1">
                </div>
            </div>
            <br>
            <div class="row-fluid">
                <div class="span2">
                </div>
                <div class="span6">
                    <center>
                        Copyright 2018 Inc.All rights reserved. 旅游网 版权所有 晋ICP备xxxxx号-1
                    </center>
                </div>
                <div class="span4">
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

<script src="<%=basePath%>statics/libs/jquery.min.js"></script>
<script src="<%=basePath%>statics/libs/vue.min.js"></script>
<script src="<%=basePath%>statics/libs/router.js"></script>
<script src="<%=basePath%>statics/libs/bootstrap.min.js"></script>
<script src="<%=basePath%>statics/plugins/layer/layer.js"></script>
<script>
    //首页轮播图时间
    $(function(){
        $('#carousel-339691').carousel({
            interval: 3000
        });
    });
    //主要菜单-城市菜单
    $.ajax({
        url : "<%=basePath%>api/tcity/list",
        data : "",
        success : function(data) {
            var json=JSON.parse(data).cityList;
            $.each(json, function(index, item) {
                var a='<li><a href="<%=basePath%>api/tcity/info?id='+item.id+'">'+item.cityName+'</a></li>';
                $("#citylistid").append(a);
            });
        }
    });
    //主要菜单-山水旅游菜单
    $.ajax({
        url : "<%=basePath%>api/category/list",
        data : "",
        success : function(data) {
            var json=JSON.parse(data).categoryList;
            $.each(json, function(index, item) {
                var a='<li><a href="<%=basePath%>api/category/info?id='+item.id+'">'+item.name+'</a></li>';
                $("#categorylistid").append(a);
            });
        }
    });
    //主要菜单-主要景点菜单
    $.ajax({
        url : "<%=basePath%>api/info/list",
        data : "",
        success : function(data) {
            var InfoList=JSON.parse(data).InfoList;
            var length=InfoList.length;
            for(var i=length-1;i>length-6;i--){
                var html='<li><a href="<%=basePath%>api/info/info?id='+InfoList[i].id+'">'+InfoList[i].tourName+'</a></li>';
                $('#infolistid').append(html)
            }
            $('#infolistid').append(html)
        }
    });
    $("#username").keydown(function(){
        var userName=$("input[name='userName']").val();
        $.ajax({
            url : "<%=basePath%>api/tuser/getuser?userName="+userName,
            data : "",
            success : function(data) {
                var code=JSON.parse(data).code;
                if(code==200){
                    alert("用户名已经存在，请重新输入");
                    $("#username").val("");
                    //$("#username").append("用户名已经存在，请重新输入");
                }
            }
        });
    });
    function checksession()
    {
        var strSession = '<%=session.getAttribute("user_login")%>';
        if( strSession !='null')
        {
            document.getElementById("regedit").innerText = "";
            document.getElementById("login").innerText = "";
            document.getElementById("logout").innerText = "注销";
        }
    }
</script>

